//
//  PriceTitleView.m
//  beautyAccompany
//
//  Created by xiaocankeji on 15/11/26.
//  Copyright © 2015年 xiaocankeji. All rights reserved.
//

#import "PriceTitleView.h"
#define kSelectColor  RGBA(246, 120, 125, 1)
#define kNOSelectColor RGBA(133, 133, 133, 1)

@interface PriceTitleView ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *priceLabel;
@end

@implementation PriceTitleView
- (instancetype)init
{
    self = [super init];
    if (self) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.font = kFont(18);
        _titleLabel.textColor = kNOSelectColor;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_titleLabel];
        
        _priceLabel = [[UILabel alloc] init];
        _priceLabel.font = kFont(12);
        _priceLabel.textAlignment = NSTextAlignmentCenter;
        _priceLabel.textColor = kNOSelectColor;
        [self addSubview:_priceLabel];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(0, 5, self.width, self.height/2-5);
    _priceLabel.frame = CGRectMake(0, 5+self.height/2-5, self.width, self.height/2-5);
}


- (void)setTitle:(NSString *)title
{
    _title = title;
    _titleLabel.text = title;
}
- (void)setPrice:(NSString *)price
{
    _price = price;
    _priceLabel.text = price;
}
- (void)setSelect:(BOOL)select
{
    _select = select;
    if (select) {
        _priceLabel.textColor = kSelectColor;
        _titleLabel.textColor = kSelectColor;
        self.backgroundColor = RGBA(244, 244, 244, 1);
        
    }else{
        _priceLabel.textColor = kNOSelectColor;
        _titleLabel.textColor = kNOSelectColor;
        self.backgroundColor = [UIColor whiteColor];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
